home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / smailsrc.zip / PASSWD.ZIP / GETPWUID.C < prev    next >
Text File  |  1990-04-03  |  489b  |  32 lines

  1. /*
  2.  *      getpwuid.c: Get password file entry by user id
  3.  *
  4.  *      Stephen C. Trier
  5.  *      March 26, 1990
  6.  *
  7.  *      This program is in the public domain
  8.  *
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include <pwd.h>
  13.  
  14. extern FILE *_pw_file;
  15.  
  16. struct passwd *getpwuid(int id)
  17. {
  18.     struct passwd *temp;
  19.  
  20.     if (setpwent())
  21.     return NULL;
  22.     while (temp = getpwent())
  23.     if (temp->pw_uid == id)  {
  24.         setpwent();
  25.         return temp;
  26.         }
  27.     setpwent();
  28.     return NULL;
  29. }
  30.  
  31.  
  32.